import re

import  requests
from  selenium import  webdriver
from  selenium.webdriver.chrome.options import Options
from  selenium.webdriver.chrome.service import Service
from  selenium.webdriver.common.by import By
option = Options()
option.add_argument("--headless")
option.add_argument("--disable-gpu")
service = Service(r"F:\桌面\win_r\浏览器驱动\chrome/chromedriver.exe")
driver = webdriver.Chrome(options=option, service=service)
url ="https://space.bilibili.com/1411243914/video?tid=0&page=1&keyword=&order=pubdate"
driver.get(url)
# print(driver.page_source)
record = []
record.__add__()
page =1
res =   re.findall("<a href=\".{,50}\" target=\"_blank\" title=\".*\" class=\"title\">",driver.page_source)
print(len(res))
for i in res :
        print(i)
        href  = i.split("href=\"")[1].split("\" ")[0];
        title = re.findall("title=\".*\" ",i)[0].replace("title=","").replace("\"","")
        record.append([href,title])

res = re.findall("<span class=\"time\"><i class=\"icon\"></i>.*-\d{1,2}",driver.page_source)
print(len(res))
for i in range(len(res/2)):
   record[i].append(res[i].replace("<span class=\"time\"><i class=\"icon\"></i>",""))






